from django.db import models
from django.utils.translation import gettext_lazy as _
from d115.mixins import *

class Queue(NomenclatureMixin):
    pass

class MQTask(AuditMixin, NomenclatureMixin):
    queue = models.ForeignKey(Queue, related_name="tasks")
    priority = models.IntegerField(default=0)
    payload = models.TextField(blank=True, null=True)
    status = models.CharField(max_length=255, choices=(('pending', _('Pending')), ('processing', _('Processing')), ('completed', _('Completed')), ('deferred', _('Deferred')),('error', _('Error'))), default='pending')
    def __unicode__(self):
        return u"Job ID# %d (%s)" % (self.id, self.status)
